import React, { Component } from 'react'

export default class ClassCounter extends Component {
  state = {
    count: 0
  }

  componentDidMount() {
    document.title = this.state.count
  }

  componentDidUpdate() {
    document.title = this.state.count
  }

  handleClick = () => {
    this.setState((state) => {
      return {
        count: state.count + 1
      }
    })
  }

  render() {
    return (
      <>
        <h1>{this.state.count}</h1>
        <button onClick={this.handleClick}>add</button>
      </>
    )
  }
}
